package utils;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @author 吴阳基
 * @datetime 2024/1/18 9:39
 */
public class BaseDao {
    public static Connection getConnection() {
        Connection connection = null;
        String driver = ConfigManager.getInstance().getValue("driver");
        String url = ConfigManager.getInstance().getValue("url");
        String username = ConfigManager.getInstance().getValue("username");
        String password = ConfigManager.getInstance().getValue("password");
        try {
            Class.forName(driver);
            connection = DriverManager.getConnection(url, username, password);
            return connection;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return connection;
    }
}
